<?php
/**
 * Created by jinqiang on 2024/8/26 10:07.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Soa;


use App\Http\Controllers\Controller;
use App\Http\Services\Soa\ReturnsService;
use Illuminate\Http\Request;

class ReturnsController extends Controller
{
    public function list(Request $request, ReturnsService $returnsService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $returnsService->search($param);
        return result($res);
    }

    //设置延期时间
    public function setDate(Request $request, ReturnsService $returnsService)
    {
        $this->validate($request, [
            'ids' => 'required',
            'type' => 'required|in:1,2,0,11'//延期1个月、延期2个月、寄卖、正常
        ]);
        $param = $request->all();
        $res = $returnsService->setDate($param);
        return $res['code'] === 0 ? success("设置成功") : error($res['msg'], $res);
    }
}

